$(function () {
    $("#head").load("/html/head.html");
    $("#foot").load("/html/foot.html");
    seletMessage();
})

function seletMessage() {
    let data = myAjax("/message","","get");
    let list = data.list;
    $("#main").attr("href", list[0].href);
    $("#main").text(list[0].title);
    $("#now").attr("href", list[4].href);
    $("#now").text(list[4].title);
}

function submitMessage() {
    let data1 = {
        name: $("#name").val(),
        email: $("#email").val(),
        content: $("#content").val()
    };
    let data = myAjax("/message",data1,"post");
    let result = data.result;
    if (result == 1){
        alert("留言成功");
    }else {
        alert("留言失败");
    }
}